package com.zhu.ecology;

/**
 * Created by DELL on 2016/2/1.
 */
public class SignInOrUp {

    public static void main(String[] args){
        String username = null;
        String pwd = null;
        String signType = Sign.SIGN_IN;
        if(args.length > 0){
            signType = args[0];
        }

        Sign s = new Sign();

        if(args.length > 1){
            s.setUserName(args[1]);
        }

        if(args.length > 2){
            s.setPassword(args[2]);
        }

        String result = Sign.SIGN_IN.equals(signType)?s.signIn():s.signUp();
        System.out.println(" --------------[" + s.getUserName() + "]---------------");
        System.out.println("!---->签到以第一次签到为准。");
        System.out.println("-------------------------------------");
        System.out.print("|\t");
        if(result == null){
            System.out.print("failed");
        }else{
            String signStr = Sign.SIGN_IN.equals(signType)? "签到":"签退";
            System.out.print(signStr + "时间：" + result);
        }
        System.out.println("\t|");
        System.out.println("-------------------------------------");
        System.out.println("!---->签退以最后一次签到为准。");
    }
}
